const path = require('path')
const fs = require('fs')
const Url = require('url')
// const exporess = require('express')
const exporess = require('./my-exporess')

const app = exporess()

app.get('/user', (req, res) => {
    let filePath = path.resolve(__dirname, `./public/user.html`)
    fs.createReadStream(filePath).pipe(res)
})

app.get('/orderList', (req, res) => {
    let d = [
        {
            id: 1, data: 'mac'
        },
        {
            id: 2, data: 'Iphone 12'
        },
    ]
    res.end(JSON.stringify(d))
})

app.listen(3000, () => {
    console.log('server is ruing port: 3000')
})
